//
//  A.swift
//  testSwift
//
//  Created by zhou Can on 15/7/8.
//  Copyright (c) 2015年 zhou Can. All rights reserved.
//

import UIKit
typealias myblock = (progress:String) -> Void

class A: NSObject {
    
    var demo:String?
    
    var name:String{
        get {
            return "A"
        }
        set{
            self.demo = newValue
        }
    }
    
    
    
    weak var b:B?
    
    init(str:String!) {
        super.init()
        self.name = str
        let delayInSeconds = 1.0
        let popTime = dispatch_time(DISPATCH_TIME_NOW,
            Int64(delayInSeconds * Double(NSEC_PER_SEC))) // 1
        dispatch_after(popTime, dispatch_get_main_queue()) { // 2

            self.block?(progress:self.name)
        }
    }
    
    var block:myblock?
    
    var block2:((progress:String) -> Void)?
    
    func testBlock(testblock:((str:String) -> Void)?){
        testblock?(str: "testBlock")
    }
    deinit{
        println("A is Deinit he b is \(b)")
    }
}
